require 'spec_helper'
require 'osx/cocoa'
require 'macos/main_view'
include OSX

describe STMainView, "when paused" do
  before(:each) do    
    @view = STMainView.alloc.init
    @controller = mock("GameController", :null_object => true)
    @controller.game = mock("Game")
    @controller.game.stub!(:paused?).and_return(true)
    @controller.game.stub!(:objects).and_return([])
    @view.controller = @controller
  end
  
  it "should return the same font instance each time" do
    font = @view.createFont
    font2 = @view.createFont
    
    font.object_id.should == font2.object_id
  end
  
  it "should render paused text when game is paused" do
    @view.stub!(:drawSpace).and_return(nil) # Override the drawSpace method to prevent any attempt at rendering.
    @view.stub!(:drawObjects).and_return(nil)
    
    @view.should_receive(:drawPaused).once
    @view.drawRect(nil)
    
    @controller.game.stub!(:paused?).and_return(false)
    @view.should_not_receive(:drawPaused)
    @view.drawRect(nil)
  end
end